package com.xzjt.web.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 用户角色
 * </p>
 *
 * @author yuandong
 * @since 2021-10-12
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class SysRole implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 角色id
     */
    @TableId(value = "role_id", type = IdType.AUTO)
    private Integer roleId;

    /**
     * 角色名称
     */
    private String roleName;


    /**
     * 角色Code
     */
    private String roleCode;

    /**
     * 1:正常 2：停用
     */
    private String status;

    /**
     * 是否删除  0 正常  1 删除
     */
    private Integer delFlag;


    /**
     * 角色对应的权限
     */
    @TableField(exist = false)
    private List<SysMenu> menus;





    /**
     * 备注
     */
    private String remark;

    public boolean isAdmin(){ return isAdmin(this.roleId);}

    public static boolean isAdmin(Integer roleId){  return roleId != null && 1 == roleId; }






}
